
var actualSelectedItem  = null;
var actualSelectedLevel = -1;

function itemSelection(itemId, level) {
	var item = document.getElementById(itemId);	
	var parent = item.parentNode;
	while (parent.tagName != 'li') {			
		parent = parent.parentNode;
	}
	if (actualSelectedItem != null) {
		actualSelectedItem.className = 'sgm-menu-item level-' + actualSelectedLevel;
	}	
	parent.className = 'sgm-menu-item level-' + level + ' selected';
	actualSelectedItem  = parent;
	actualSelectedLevel = level; 
}

function selectionFirst(rootId, level) {
	var root  = document.getElementById(rootId);	
	var listMenus = root.getElementsByTagName('LI');	
	listMenus[0].className = 'sgm-menu-item level-' + level + ' selected';
	actualSelectedItem  = listMenus[0]; 
	actualSelectedLevel = level;
}
